package com.ldr.custom.spring.v2.beans;

import com.ldr.custom.spring.v2.core.GPFactoryBean;

public class GPBeanWrapper extends GPFactoryBean {

    //还会用到观察者模式
    //支持事件响应，会有一个监听
    private GPBeanPostProcessor postProcessor;

    private Object wrapperInstance;
    //原生的通过反射new出来，要把它包装起来，存下来
    private Object originalInstance;


    public GPBeanWrapper(Object instance){
        this.originalInstance=instance;
        this.wrapperInstance=instance;
    }

    public Object getWrapperInstance() {
        return wrapperInstance;
    }

    /**
     * 返回代理以后代class
     * 可能会是这个$Proxy0
     */
    public Class<?> getWrapperClass(){
        return this.wrapperInstance.getClass();
    }

    public GPBeanPostProcessor getPostProcessor() {
        return postProcessor;
    }

    public void setPostProcessor(GPBeanPostProcessor postProcessor) {
        this.postProcessor = postProcessor;
    }
}
